
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <string>
#include <iostream>
#include "OutputListBox.h"
#include "OutputController.h"
#include "PersonList.h"
#include "LengthDisplayFormat.h"


#include "Length.h"
#include "LengthUnit.h"


USING_MOCKCPP_NS
USING_TESTNGPP_NS

using std::ostream;


#if 1
void test_should_output_listbox_update()
{
    MockObject<IOutputView> outputView;
    std::stringstream os;

    MOCK_METHOD(outputView, radioButton_onSelected)
                .expects(atLeast(1))
                .will(ignoreReturnValue())
                .id("radioButton_onSelected");

    MOCK_METHOD(outputView, update)
                .expects(atLeast(1))
                .with(eq(&os))
                .after("radioButton_onSelected")
                .after("display")
                .will(ignoreReturnValue())
                .id("update");

    MOCK_METHOD(outputView, display)
                .expects(atLeast(1))
                .with(eq(&os))
                .will(ignoreReturnValue())
                .id("display");

    //OutputController(outputView);

}
#endif

FIXTURE(OutputController)			
{

	 
    TEST(shoule be able to display Person List)
    {



        FeetInchUnitDisplay df;
	PersonList personList(&df);
        stringstream ostr;
        
        ostr<<personList;
		
        ASSERT_EQ( ostr.str(), "Name\tHeigth\nSan Chang\t5 FEET 1 INCH\nSi Li\t5 FEET 7 INCH\nWu Wang\t7 FEET 9 INCH\nName\tHeigth\nHui Qin\t4 FEET 6 INCH\nFei Yue\t7 FEET 2 INCH\nGou Zhao\t5 FEET 4 INCH\n");
    }

    
};


